import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'logic.dart';

class GetxVcPage extends GetView<GetxVcLogic>{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('状态管理'),
        ),
        body: Center(
          child: Container(
            margin: EdgeInsets.only(top: 50),
            child: Column(
              children: [
                GetBuilder<GetxVcLogic>(
                  builder: (controller) {
                    return Text("count的值为:  ${controller.state.count}",
                        style: TextStyle(color: Colors.red, fontSize: 30));
                  },
                ),
                // Obx(() {
                //   return Text("监听值改变:  ${controller.count}",
                //       style: TextStyle(color: Colors.red, fontSize: 30));;
                // }),
                ElevatedButton(
                    onPressed: () {
                      controller.increase();
                    },
                    child: Text("改变数据")),
              ],
            ),
          ),
        ));
  }
}
